package com.atguigu.crowd.funding.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.atguigu.crowd.funding.entity.Menu;
import com.atguigu.crowd.funding.entity.MenuExample;
import com.atguigu.crowd.funding.mapper.MenuMapper;
import com.atguigu.crowd.funding.service.api.MenuService;

@Service
public class MenuServiceImpl implements MenuService {

	@Autowired
	private MenuMapper menuMapper;
	
	@Override
	public List<Menu> getAllMenu() {
		// TODO Auto-generated method stub
		List<Menu> menus=menuMapper.selectByExample(new MenuExample());
		return menus;
	}

	@Override
	public void saveNode(Menu menu) {
		// TODO Auto-generated method stub
		menuMapper.insert(menu);
	}

	@Override
	public void removeNode(Integer id) {
		// TODO Auto-generated method stub
		menuMapper.deleteByPrimaryKey(id);
	}

	@Override
	public Menu getNodeById(Integer id) {
		// TODO Auto-generated method stub
		return menuMapper.selectByPrimaryKey(id);
	}

	@Override
	public void updateNode(Menu menu) {
		// TODO Auto-generated method stub
		menuMapper.updateByPrimaryKey(menu);
	}

}
